﻿function __card(){}

__card.prototype.state2text=function(s)
{
	var r;
	switch(parseInt(s))
	{
		case 0:r="未激活";break;
		case 1:r="已激活，未提货";break;
		case 2:r="已提货，未发货";break;
		case 3:r="已提货，已发货"; break;
		case 4:r="完成收货确认"; break;
		default:r="未知";break;
	}
	return r;
}
__card.prototype.queryCardByCardNum = function(s) {
//$ajax.debug=true;
    //window.open("/th/admin/xmlcard.aspx?cardnum=" + s);
    $ajax.load({ url: "/th/admin/xmlcard.aspx", data: "datatype=json&cardnum=" + s, type: "json" });
    return $ajax.responseJson;
}
__card.prototype.queryCardTypeByCardTypeId = function(s) {
    //$ajax.debug=true;
    //window.open("/th/admin/xmlcardtype.aspx?datatype=json&cardtypeid=" + s);
    $ajax.load({ url: "/th/admin/xmlcardtype.aspx", data: "datatype=json&cardtypeid=" + s, type: "json" });
    return $ajax.responseJson;
}

__card.prototype.createNewCard = function(s) {
    //$ajax.debug=true;
    //window.open("/th/admin/xmlcard.aspx?cardnum=" + s);
    $ajax.load({ url: "/th/usercreatenewcard.aspx", data: "cardtypeid=" + s, type: "json" });
    return $ajax.responseJson;
}

__card.prototype.getDiscountrate = function(discountrateString, __cardtypeid) {
    var i;
    var _t = discountrateString.split("|");
    for (i = 0; i < _t.length; i++) {
        _v = _t[i].split(',');
        if (parseInt(_v[0]) == parseInt(__cardtypeid)) {
            return _v[1];
        }
    }
    return 1;

}

var $card = new __card();

function tipsShow(html) {
    $("#dialogLoginTips .tips").html(html);
    $('#dialogLoginTips').dialog({
        autoOpen: true,
        width: 600,
        resizable: false,
        modal: true,
        title: "温馨提示"
    });
}